SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

alter   trigger tfb_fixedassets_ai on dbo.tfb_fixedassets
after insert
 as    
  declare @new_sumdepramt decimal (18,2);
  declare @new_sumusedmonth integer;
  declare @new_sumworkedvalue decimal (18,2);	
  declare @new_fixedassetid decimal (18,2);	

begin    
  set nocount on
  select @new_fixedassetid=fixedassetid,
          @new_sumdepramt = sumdepramt,
          @new_sumusedmonth = sumusedmonth,
          @new_sumworkedvalue = sumworkedvalue
    from inserted

  update tfb_fixedassets set addvoucherid = null,startsumdepramt = @new_sumdepramt,
    startsumusedmonth = @new_sumusedmonth,startsumworkedvalue = @new_sumworkedvalue 
    where fixedassetid=@new_fixedassetid;
end

GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

